package com.vma.interfaceShoes.util;

import java.util.HashMap;
import java.util.Map;


/**
 * 协议处理工具类
 * 
 * @author 
 * 
 */
public class ReturnsUtil {
	
	
	
	/**
	 * 处理成功返回协议对象
	 * @param  data
	 * @return
	 */
	public static Map returnSuccess(Object data){
		Map<String, Object> jsonMap = new HashMap<String, Object>();
		jsonMap.put("resultCode","0");
		jsonMap.put("resultMsg","处理成功!");
		jsonMap.put("data", data);
		return jsonMap;
	}

	public static Map returnFail(Object data, String code){
		Map<String, Object> jsonMap = new HashMap<String, Object>();
		jsonMap.put("resultCode",code);
		jsonMap.put("resultMsg","处理成功!");
		jsonMap.put("data", data);
		return jsonMap;
	}


	public static Map<String, Object> returnException(String msg, Exception e){
		Map<String, Object> jsonMap = new HashMap<String, Object>();
		jsonMap.put("resultCode","-1");
		jsonMap.put("resultMsg",msg+":系统异常!");
		jsonMap.put("data", e.getMessage());

		return jsonMap;
	}
	
}
